package com.mazong.serversecbasic.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class MainController {

    private final Logger log = LoggerFactory.getLogger(this.getClass());

    @RequestMapping(value = "/")
    public String root() {
        return "index";
    }

    // user:c6a83da8-32a7-41d1-b4cd-021bf0415343
    @RequestMapping(value = "/index")
    public String index() {
        return "index";
    }

    @RequestMapping(value = "/403")
    public String error() {
        return "403";
    }

    @RequestMapping(value = "/login")
    public String login() {
        return "login";
    }

    @RequestMapping(value = "/login-error")
    public String loginFailed(Model mode) {
        mode.addAttribute("loginError", true);
        return "login";
    }

    @RequestMapping(value = "/product/select")
    public String select() {
        return "product/select";
    }

    @RequestMapping(value = "/product/insert")
    public String insert() {
        return "product/insert";
    }

    @RequestMapping(value = "/product/update")
    public String update() {
        return "product/update";
    }

    @RequestMapping(value = "/product/delete")
    public String delete() {
        return "product/delete";
    }
}
